package com.ssm.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.polo.Customer;
import com.ssm.service.CustomerService;

@Controller
public class CustomerController {
	@Autowired
	private CustomerService customerService;
	@RequestMapping(value="/findCustomerById")
	@ResponseBody
	public Customer findCustomerById(){
		Customer customer = this.customerService.findCustomerById(1);
		return customer;
	}
	/*public String findCustomerById(Model model){
		Customer customer = this.customerService.findCustomerById(1);
		model.addAttribute("customer",customer);
		return "success";
	}*/
	
	@RequestMapping("/findCustomerById2")
	@ResponseBody
	public Map<String,Object> findCustomerById2(){
		Map<String,Object> map = new HashMap<String,Object>();
		Customer customer = this.customerService.findCustomerById(2);
		map.put("success", true);
		map.put("msg", "成功");
		map.put("data", customer);
		return map;
	}
	
	
	
	
	
	
	
}
